package org.robotlegs.demos.lazyfsm.views.mediators
{
	import org.robotlegs.core.IMediator;
	import org.robotlegs.mvcs.Mediator;
	import org.robotlegs.demos.lazyfsm.events.ApplicationEvent;
	import org.robotlegs.demos.lazyfsm.views.components.IntroView;
	import org.robotlegs.demos.lazyfsm.views.components.LoginView;

	public class IntroViewMediator extends Mediator
	{
		[Inject]
		public var view:IntroView;

		public function IntroViewMediator()
		{
			super();
		}

		override public function onRegister():void
		{
			addEventListenerTo(eventDispatcher, ApplicationEvent.CHANGE_INTROVIEW_STATE, handleShowLogin);
			mediatorFactory.mapMediator(LoginView,LoginViewMediator);
		}

		protected function setLabelText(value:String):void
		{
			view.lazyTitle.text=value;
		}

		protected function handleShowLogin(event:ApplicationEvent):void
		{
			var msg:String=event.appMessage as String;
		//	this.setLabelText(msg);
			view.currentState=msg;
		}
	}
}